import 'package:fish_redux/fish_redux.dart';

class ClassState implements Cloneable<ClassState> {
  String id;
  String name;
  String gradeId;
  String gradeText;
  String teacherName;

  ClassState(
      {this.id, this.name, this.gradeId, this.gradeText, this.teacherName});

  factory ClassState.fromJson(Map<String, dynamic> json) {
    return ClassState(
        id: json['id'] ?? json['code'] ?? '',
        name: json['name'],
        gradeId: json['gradeId'],
        gradeText: json['gradeText'],
        teacherName: json['teacherName'] ?? '');
  }

  @override
  ClassState clone() {
    return ClassState()
      ..id = id
      ..name = name
      ..gradeId = gradeId
      ..gradeText = gradeText
      ..teacherName = teacherName;
  }

  @override
  String toString() {
    return 'ClassState{title: $name}';
  }
}
